<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .active{
      color: rgb(175, 175, 32);
    }
    .p{
      font-size: 100px;
    }
  </style>
</head>
<body>
  <div id="app">
    <p :class = "{p:true, active:isActive}">只因</p>
    <button @click="change">切换</button>
  </div>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  <script>
    const app = new Vue({
      el:'#app',
      data:{
        className:'',
        isActive:false
      },
      methods:{
        change(){
           this.isActive = !this.isActive
        }
      
    }
  })
  </script>
</body>
</html>